*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
}

ul {
    display: flex;
}

ul li {
    position: relative;
    width: 150px;
    height: 50px;
    cursor: pointer;
    list-style: none;
    /* 让子元素保留其 3D 位置 */
    transform-style: preserve-3d;
    transition: all 1s;
}

ul li:hover {
    transform: rotateX(90deg);
}

ul li:hover div:first-child {
    background-color: #51938f;
    background-size: 5px 5px;
    background-position: 30px 30px;
    background-image: linear-gradient(45deg, #478480 25%, rgba(0,0,0,0) 25%, rgba(0,0,0,0) 75%, #478480 75%, #478480);
}

ul li div {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    line-height: 50px;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    text-align: center;
}

ul li div:first-child {
    background-color: #74adaa;
    transform: translateZ(25px);
}

ul li div:last-child {
    background-color: #51938f;
    background-size: 5px 5px;
    background-position: 30px 30px;
    background-image: linear-gradient(45deg, #478480 25%, rgba(0,0,0,0) 25%, rgba(0,0,0,0) 75%, #478480 75%, #478480);
    /* 让第二个面往下移动 25 px，沿着 x 轴旋转 -90 度 */
    transform: translateY(25px) rotateX(-90deg);
}
